package errors

type Err int

const (
	ConectionClosed Err = iota
	ConectionReset
	ConnectionReadTimeout
	ServerShutdown
	BadDataChecksum
)

var errString = map[Err]string{
	ConectionClosed:       "connection closed",
	ConectionReset:        "connection reset by peer",
	ConnectionReadTimeout: "read timeout",
	ServerShutdown:        "server shutdown",
	BadDataChecksum:       "data broken, bad checksum",
}

func (e Err) Error() string {
	if s, ok := errString[e]; !ok {
		panic("Invalid err type.")
	} else {
		return s
	}
}
